#===============================================================================
# Makefile
#===============================================================================

#-------------------------------------------------------------------------------
# We start with the configuration file.
#-------------------------------------------------------------------------------

CC = gcc
LD = gcc
CFLAGS = -O3 -W -Wall
LDFLAGS =

#-------------------------------------------------------------------------------
# Main target
#-------------------------------------------------------------------------------

PROGS = testgreen testgreenklee quitgreen

all : $(PROGS)

#-------------------------------------------------------------------------------
# High-level rules
#-------------------------------------------------------------------------------

testgreen : testgreen.o green.o

testgreen.o : testgreen.c

testgreenklee : testgreenklee.o green.o

testgreenklee.o : testgreenklee.c

quitgreen : quitgreen.o green.o

quitgreen.o : quitgreen.c

green.o : green.c green.h

#-------------------------------------------------------------------------------
# Low-level rules
#-------------------------------------------------------------------------------

% : %.o
	$(LD) $(LDFLAGS) $^ -o $@

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@



#-------------------------------------------------------------------------------
# Cleaning up.
#-------------------------------------------------------------------------------

clean :
	rm -f core *.o $(PROGS)

#===============================================================================
# End of Makefile
#===============================================================================
